<?php

defined('MYLITS') ? '' : exit('No direct script access allowed');

/**
 * @version     1.0.0
 * @package     mylits engine
 * @license     GNU General Public License version 3
 * @author      Arfan Fudyartanto D N <arfan@mylits.com> - http://engine.mylits.com
 */
class Mylits_Document {

    private static $instance;

    /**
     * This method will return Mylits_Document object
     * 
     * @return object Mylits_Document
     */
    public static function getInstance() {
        if (is_null(self::$instance)) {
            self::$instance = new self();
        }
        return self::$instance;
    }

    public static function addStyle($path, $weight = NULL) {
        if (!empty($weight)) {
            if (!in_array($path, $_SESSION['doc']['styles'])) {
                $_SESSION['doc']['styles'][$weight] = $path;
            }
        } else {
            $_SESSION['doc']['styles'][] = $path;
        }
    }

    public static function addScript($path, $weight = NULL) {
        if (!empty($weight)) {
            if (!in_array($path, $_SESSION['doc']['scripts'])) {
                $_SESSION['doc']['scripts'][$weight] = $path;
            }
        } else {
            $_SESSION['doc']['scripts'][] = $path;
        }
    }

}

?>
